﻿using HZU.ZP.Data.Impl;
using HZU.ZP.Data.Interfaces;
using HZU.ZP.Domain.IService;
using HZU.ZP.Domain.Model;
using HZU.ZP.Domain.ServiceImpl.Mappers;
using System;
using System.Collections.Generic;
using System.Text;

namespace HZU.ZP.Domain.ServiceImpl.PCSvc
{
    public class CollectRecordService:ICollectRecordService
    {
        private CollectRecordMapper _mapper = new CollectRecordMapper();
        private PositionMapper _positmapper = new PositionMapper();
        private ICollectRecordDao _sqlData;
        public CollectRecordService(ICollectRecordDao sqlData)
        {
            _sqlData = sqlData;
        }

        public bool Add(CollectRecord collectRecord)
        {
            var collectRecordDao = _mapper.MapToDao(collectRecord);
            _sqlData.Add(collectRecordDao);
            return true;
        }

        public bool DeleteCollect(int appliacntId, int positionId)
        {
            _sqlData.Delete(appliacntId, positionId);
            return true;
        }

        public CollectRecord Get(int appliacntId, int positionId)
        {
            return _mapper.MapToDomain(_sqlData.Get(appliacntId, positionId));
        }

        public IList<Position> GetAllCollect(string sql)
        {
            return _positmapper.MapToDomainList(_sqlData.Get(sql));
        }
    }
}
